//
//  SISSBaseScrollViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2017/10/23.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSBaseScrollViewController.h"

@interface SISSBaseScrollViewController ()

@end

@implementation SISSBaseScrollViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)setupSubviews {
    [super setupSubviews];
    
    UIScrollView *scrollView = [[UIScrollView alloc] init];
    scrollView.delegate = self;
    [self.view addSubview:scrollView];
    self.scrollView = scrollView;
    
    // 1. 添加一个视图，四周和 scrollView 一致
    SISSBaseView *containerView = [[SISSBaseView alloc] init];
    containerView.backgroundColor = [UIColor whiteColor];
    containerView.userInteractionEnabled = YES;
    [scrollView addSubview:containerView];
    self.containerView = containerView;
    
    // 2. 自动布局
    WeakSelf
    [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weakSelf.view);
        if (@available(iOS 11.0, *)) {
            make.top.equalTo(weakSelf.mas_topLayoutGuideBottom);
            make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
        } else {
            make.top.equalTo(weakSelf.view);
            make.bottom.equalTo(weakSelf.view);
        }
    }];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(scrollView);
        make.width.mas_equalTo([SISSPublicSingleton shared].screenWidth);
        // 通过宽高设置 contentSize
        // make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT * 1.5));
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
